package com.qys.livesMall.event.config;

import com.qys.livesMall.anchor.mapper.AnchorRewardConfigMapper;
import com.qys.livesMall.anchor.service.H2AnchorService;
import com.qys.livesMall.anchor.service.UserGradeIntegralService;
import com.qys.livesMall.app.user.mapper.UserShopStatisticsMapper;
import com.qys.livesMall.app.user.service.*;
import com.qys.livesMall.cache.RedisCache;
import com.qys.livesMall.event.listener.*;
import com.qys.livesMall.finance.service.FinanceBusinessService;
import com.qys.livesMall.financial.service.FinancialOfflineUserService;
import com.qys.livesMall.shop.service.ShopStatisticsTeamService;
import com.qys.livesMall.shortVideo.service.IH2ShortVideoService;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/04/25
 * Time: 17:34
 * DESCRIPTION: 事件监听配置类
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@RequiredArgsConstructor
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication
public class EventConfig {

    @Bean
    public ShopEventListener shopEventListener() {
        return new ShopEventListener();
    }


    @Bean
    public ShortVideoListener shortVideoListener(IH2ShortVideoService shortVideoService) {
        return new ShortVideoListener(shortVideoService);
    }

    @Bean
    public UserFriendListener userFriendListener(AppUserFriendService userFriendService) {
        return new UserFriendListener(userFriendService);
    }

    @Bean
    public OfflineFinishRewardListener offlineFinishRewardListener(FinancialOfflineUserService offlineUserService) {
        return new OfflineFinishRewardListener(offlineUserService);
    }

    @Bean
    public AnchorServiceListener anchorServiceListener(H2AnchorService anchorService,
                                                       AnchorRewardConfigMapper anchorRewardConfigMapper,
                                                       FinanceBusinessService financeBusinessService

                                                       ) {
        return new AnchorServiceListener(anchorService, anchorRewardConfigMapper, financeBusinessService);
    }
    @Bean
    public UserShopStatisticsListener userShopStatisticsListener(UserShopStatisticsService userShopStatisticsService,
                                                                 UserStatisticsInfoService userStatisticsInfoService,
                                                                 UserStatisticsTeamService userStatisticsTeamService,
                                                                 IpOperateStatisticsService ipOperateStatisticsService,
                                                                 UserShopStatisticsMapper userShopStatisticsMapper,
                                                                 IH2AppUserService appUserService) {
        return new UserShopStatisticsListener(userShopStatisticsService,userStatisticsInfoService, userStatisticsTeamService,ipOperateStatisticsService,userShopStatisticsMapper,appUserService);
    }

    @Bean
    public UserRechargeListener userRechargeListener(UserStatisticsInfoService userStatisticsInfoService) {
        return new UserRechargeListener(userStatisticsInfoService);
    }

    @Bean
    public LoginListener loginListener(UserShopStatisticsService userShopStatisticsService) {
        return new LoginListener(userShopStatisticsService);
    }


    @Bean
    public UserIncomeDayListener userIncomeDayListener(UserStatisticsDayLogService userStatisticsDayLogService,UserStatisticsInfoService userStatisticsInfoService) {
        return new UserIncomeDayListener(userStatisticsDayLogService,userStatisticsInfoService);
    }

    @Bean
    public GoldRecordListener goldRecordListener(UserStatisticsInfoService userStatisticsInfoService) {
        return new GoldRecordListener(userStatisticsInfoService);
    }

    @Bean
    public FinanceUserAccountListener financeUserAccountListener(UserStatisticsInfoService userStatisticsInfoService,
                                                                 AppUserLevelService userLevelService,
                                                                 FinanceBusinessService financeBusinessService,
                                                                 H2AnchorService anchorService,
                                                                 RedisCache redisCache) {
        return new FinanceUserAccountListener(userStatisticsInfoService, userLevelService, financeBusinessService, anchorService, redisCache);
    }

    @Bean
    public UserTeamListener userTeamListener(UserStatisticsTeamService userStatisticsTeamService, UserShopStatisticsService userShopStatisticsService, UserStatisticsInfoService userStatisticsInfoService) {
        return new UserTeamListener(userStatisticsTeamService,userShopStatisticsService,userStatisticsInfoService);
    }
    @Bean
    public AppUserApplyWithdrawalListener appUserApplyWithdrawalListener(UserStatisticsTeamService userStatisticsTeamService,UserStatisticsInfoService userStatisticsInfoService){
        return new AppUserApplyWithdrawalListener(userStatisticsTeamService,userStatisticsInfoService);
    }

    @Bean
    public UserGradeIntegralListener userGradeIntegralListener(UserGradeIntegralService userGradeIntegralService){
        return new UserGradeIntegralListener(userGradeIntegralService);
    }

    @Bean
    public UserGradeIntegralOrderListener userGradeIntegralOrderListener(UserGradeIntegralService userGradeIntegralService){
        return new UserGradeIntegralOrderListener(userGradeIntegralService);
    }

    @Bean
    public UserLeveEditListener userLeveEditListener(UserStatisticsInfoService userStatisticsInfoService){
        return new UserLeveEditListener(userStatisticsInfoService);
    }

    @Bean
    public ChannelEditListener channelEditListener(ShopStatisticsTeamService shopStatisticsTeamService){
        return new ChannelEditListener(shopStatisticsTeamService);
    }
}
